package com.atguigu.realtime.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;

/**
 * @author chenlongStart
 * @create 2021-06-25 13:03
 * @desc
 */
public class CommonUtil {
    public static <T> List<T> toList(Iterable<T> it){
        List<T> list = new ArrayList<>();
        it.forEach(list::add);
        return list;
    }

    public static Long toTs(String dateStr){
        try {
            return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(dateStr).getTime();
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return null;
    }
}
